class Category < ActiveRecord::Base
  attr_accessible :id, :name, :parent_id
  
  validates :name, :presence => true, :uniqueness => true

  has_many :children, :class_name => "Category", :foreign_key => "parent_id"
  belongs_to :parent, :class_name => "Category"
  has_many :products
  
  
  
end
